﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Miris.HumanMilkAnalyser.WPF.Shared;
using Miris.HumanMilkAnalyser.WPF.ViewModel;

namespace Miris.HumanMilkAnalyser.WPF
{
    /// <summary>
    /// Interaction logic for AnalysisResultSummaryPage.xaml
    /// </summary>
    public partial class AnalysisResultSummaryPage : PageBase
    {
        public AnalysisResultSummaryPage()
        {
            InitializeComponent();
            InitializePageUnloadStoryboard();
        }

        private void ButtonBack_Click(object sender, RoutedEventArgs e)
        {
            GoToPage(new AnalysisResultMappingPage(), false);
        }

        private void ButtonPrint_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var reportWindow = new AnalysisReportWindow();
                var analysisReportViewModel = reportWindow.DataContext as AnalysisReportViewModel;
                var analysisResultSummaryViewModel = DataContext as AnalysisResultSummaryViewModel;
                analysisReportViewModel.IncludeBreastfeedingSignificance = analysisResultSummaryViewModel.IncludeBreastfeedingSignificance;
                analysisReportViewModel.SetPatientProperties(analysisResultSummaryViewModel);
                analysisReportViewModel.SetAllTestItemResult(analysisResultSummaryViewModel.CurrentAnalysisResult);
                analysisReportViewModel.DignosticMessageList = analysisResultSummaryViewModel.SelectedDiagnosticMessageList;
                analysisReportViewModel.AttachedDiagnosticMessage = analysisResultSummaryViewModel.AttachedDiagnosticMessage;
                analysisReportViewModel.ResetProperties();

                reportWindow.ShowDialog();
            }
            catch (Exception ex)
            {
                MyViewModelBase.RequestDisplayErrorMessage(ex.Message);
            }
        }

        private void ButtonFinish_Click(object sender, RoutedEventArgs e)
        {
            GoToPage(new MainPage());
        }
    }
}
